﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Calculator.ConsoleCalc;
using Calculator.ConsoleCalc.ExtendedCalc;

namespace Calculator
{
	class Program
	{
		static void Main(string[] args)
		{
            String arguments = "";
			ConsoleCalculator _calc = new ConsoleCalculator(new ExtParser(), new ExtCalculator(), new ExtValidator());

            if (args.Length > 0)
            {
                StringBuilder sb = new StringBuilder(arguments);
                foreach (string str in args)
                {
                    sb.Append(str);
                }
                arguments = sb.ToString();
				Console.WriteLine(_calc.Calculate(arguments));
            }
            while (true)
            {
                Console.WriteLine("Введите выражение:");
                arguments = Console.ReadLine();
				Console.WriteLine(_calc.Calculate(arguments));
            }
           

		}
	}
}
